package com.example.gaojt.androiddemo.boostDemo.aa;

import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;

public class ProcessOOMHelper {

    public static final int CACHED_APP_MIN_ADJ = 9;

    public static int getProcessOOM(int pid) {
        try {
            File stat = new File("/proc/" + Integer.valueOf(pid) + "/oom_adj");
            FileInputStream ins = new FileInputStream(stat);
            DataInputStream inReader = new DataInputStream(ins);

            String xLine = inReader.readLine();
            xLine = xLine.trim();

            inReader.close();

            return Integer.valueOf(xLine);

        } catch (Exception e) {}

        return 0;
    }
}
